/*
 * Copyright (c) 2017,重庆阿莫比科技有限公司,All Rights Reserved.
 */
package com.wowocai.btchina.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;

import com.wowocai.btchina.datasource.JdbcUtils;

/**
 * <br/>
 * Date: 2017年5月27日 上午9:47:19 <br/>
 * 
 * @Author 刘建成
 * @Version
 */
//@Service
public class TorrentDao {

    @Autowired
    DataSource dataSource;

    public Map<String, Object> findTorrentInfo(String infohash) {
        String sql = "select id,size,vcount,createtime,isvideo,infohash,`name`,hsize,files,createdate,lastupdate "
                + "from sph_idx_spider_main  where infohash='0135fbfd472a1c69494faaead21e16203931de38'";

        Connection conn = null;
        PreparedStatement st = null;
        ResultSet rs = null;
        try {
            conn = dataSource.getConnection();
            st = conn.prepareStatement(sql);
            //st.setString(1, infohash);
            // ps.setInt(1, flowAdCPID.getCompid());
            // ps.setString(2, flowAdCPID.getPackageName());
            // ps.setString(3, flowAdCPID.getCountry());
            // ps.setString(4, DateUtil.getDatetime());
            rs = st.executeQuery();
            while (rs.next()) {
                System.out.println(rs.getString("name"));
            }
            JdbcUtils.release(rs, st, conn);
        } catch (SQLException e) {
            e.printStackTrace();

        }
        return null;

    }

}
